Add list and revoke gateway token endpoints#1081
Conversation
WalkthroughAdds gateway token management: new ListTokens and RevokeToken endpoints and service methods; removes automatic token creation from gateway registration; updates README and OpenAPI to document listing tokens and expanded payload fields. Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant API as API Handler
participant Svc as Gateway Service
participant Repo as Gateway Repository/DB
Client->>API: GET /api/v1/gateways/:gatewayId/tokens (with JWT/org)
API->>Svc: ListTokens(gatewayId, orgId)
Svc->>Repo: Query active tokens for gatewayId
Repo-->>Svc: Token list
Svc-->>API: TokenInfoResponse[]
API-->>Client: 200 OK + tokens
Client->>API: DELETE /api/v1/gateways/:gatewayId/tokens/:tokenId
API->>Svc: RevokeToken(gatewayId, tokenId, orgId)
Svc->>Repo: Validate ownership & revoke token
Repo-->>Svc: success / not found
Svc-->>API: success / error
API-->>Client: 200 OK / 404 / 500
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
No actionable comments were generated in the recent review. 🎉 Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
bb7862d
Purpose
Gateway token lifecycle management is incomplete — there is no way to list active tokens or revoke a specific token. Tokens are also auto-generated on gateway registration, giving no control over when tokens are created.
Resolves #1080
Goals
Approach
GET /gateways/{gatewayId}/tokenshandler and service method to list active tokensDELETE /gateways/{gatewayId}/tokens/{tokenId}handler and service method to revoke a tokenAutomation tests
Summary by CodeRabbit
New Features
Documentation